﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Data;

namespace ScrumBoard
{

  public class CellToTaskStateConverer : IValueConverter
  {
    public static CellToTaskStateConverer Instance
    {
      get
      {
        if (_Instance == null) _Instance = new CellToTaskStateConverer();
        return _Instance;
      }
    }
    private static CellToTaskStateConverer _Instance;

    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
      var cell = (DataGridCell)value;
      var colIndex = (cell.Parent as Panel).Children.IndexOf(cell);
      return (TaskState)colIndex; //todo: vymysliet nieco lepsie. problem Column nepodporuje datacontext, ani tag
      //TaskState zacina od 1;
      //colIndex = 0 je story, nie stav
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
      throw new NotImplementedException();
    }
  }
}
